<!DOCTYPE html>
<html>
    <head>
        <script src="js/vue.js"></script>
        <script src="js/vuex.js"></script>
    </head>
    <body>
        <div id="app">
            <button @click="increment">+</button>
            <button @click="decrement">-</button>
            <p>{{this.$store.state.count}}</p>
        </div>
        <script>
            var store = new Vuex.Store({
                state : {
                    count : 0
                },
                mutations : {
                    increase(state) {
                        state.count++
                    },
                    decrease(state) {
                        state.count--
                    }
                }
            })

            var vm = new Vue({
                el : '#app',
                store,
                methods : {
                    increment() {
                        this.$store.commit('increase');
                    },
                    decrement() {
                        this.$store.commit('decrease');
                    }
                }
            })

        </script>
    </body>
</html>